<template>
	<view>
		<view class='commission-details'>
			<view class='promoterHeader bg-color'>
				<view class='headerCon acea-row row-between-wrapper'>
					<view>
						<view class='name'>提现总额</view>
						<view class='money'>￥<text class='num'>{{extractCount}}</text></view>
					</view>
					<view class='iconfont icon-jinbi1'></view>
				</view>
			</view>
			
			<block v-for="(item,index) in recordList" :key="index" v-if="recordList.length > 0">
				<u-cell-group style="margin-top: 10upx;">
					<u-cell-item :title="item.extract_type_text" :label="item.status_text" :value="item.extract_price" :arrow="false"></u-cell-item>
				</u-cell-group>
			</block>
			<view v-if="recordList.length == 0" style="margin-top: 80upx;">
				<u-empty text="数据为空" mode="list"></u-empty>
			</view>
		</view>
		<!-- #ifdef MP -->
		<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
		<!-- #endif -->
	</view>
</template>

<script>
	import { toLogin } from '@/libs/login.js';
	import { mapGetters } from "vuex";
	// #ifdef MP
	import authorize from '@/components/Authorize';
	// #endif
	import request from "@/utils/request.js";
	export default {
		components: {
			// #ifdef MP
			authorize,
			// #endif
		},
		data() {
			return {
				page: 1,
				limit: 10,
				extractCount:0,
				recordList: [],
				status: false,
				isAuto: false, //没有授权的不会自动授权
				isShowAuth: false ,//是否隐藏授权
				
			};
		},
		computed: mapGetters(['isLogin']),
		onLoad(options) {
			if (!this.isLogin) {
				toLogin();
			}
		},
		onShow: function() {
			this.getRecordList();
		},
		methods: {
			onLoadFun() {
				this.getRecordList();
			},
			// 授权关闭
			authColse: function(e) {
				this.isShowAuth = e
			},
			getRecordList: function() {
				let that = this;
				if (that.status == true) return;
				request.get('user/extract/list', {
					page: that.page,
					limit: that.limit,
					money_type: 2,
				}).then(res => {
					that.$set(that, 'extractCount', res.data.extractCount);
					that.$set(that, 'recordList', that.recordList.concat(res.data.list));
					that.status = that.limit > res.data.list.length;
					that.page++;
				});
			},
		},
		onReachBottom: function() {
			this.getRecordList();
		}
	}
</script>

<style scoped lang="scss">
	.commission-details .promoterHeader .headerCon .money {
		font-size: 36rpx;
	}

	.commission-details .promoterHeader .headerCon .money .num {
		font-family: 'Guildford Pro';
	}
</style>
